<?php
class Search extends CWidget{
	public $type = 'news';
	public function init(){
		switch($this->type){
			case 'news':
				$searchModel = new SearchForm;
				$form = $this->beginWidget('CActiveForm',array(
					'id'=>'search-form',
					'enableAjaxValidation'=>true,
					'action'=>'/search/index',
					'htmlOptions'=>array('class'=>'top_search_form'),
				));
				echo $form->textField($searchModel,'searchword',array('class'=>'con_txt jsin share_con','value'=>'新闻关键字、标签'));
				echo '<span class="icon_sousuo"></span>';
				echo Chtml::submitButton('搜索',array('class'=>'up_but search_button'));
				$this->endWidget();
				break;
			case 'user':
				$searchModel = new SearchForm;
				$form = $this->beginWidget('CActiveForm',array(
					'id'=>'search-form',
					'enableAjaxValidation'=>true,
					'action'=>'/search/user',
					'htmlOptions'=>array('class'=>'top_search_form'),
				));
				echo $form->textField($searchModel,'searchword',array('class'=>'con_txt jsin share_con','onfocus'=>'this.value=""','value'=>'用户、兴趣'));
				echo '<span class="icon_sousuo"></span>';
				echo Chtml::submitButton('找人',array('class'=>'up_but search_button'));
				$this->endWidget();
				
		}
	}
}